#!/bin/bash

export BASE_ANN_DIR=~/data/6_annotation_wunw_s.enterica


for GA_DIR in ${BASE_ANN_DIR}/annot_*; do
    9_annotation_analysis/create_results.sh "entry" "gene_functions.txt" "results_gene_functions_exp.txt.gz" $GA_DIR
done > ${BASE_ANN_DIR}/results_kegg_full_new.txt

for GA_DIR in ${BASE_ANN_DIR}/annot_*; do
    9_annotation_analysis/create_results.sh "exact" "genes_go.txt" "results_gene_ontology.txt.gz" $GA_DIR
done > ${BASE_ANN_DIR}/results_go_exact.txt


# GENE_ID   AN_DIR    RES1   RES2  RES3 
cat ${BASE_ANN_DIR}/results_kegg_full_new.txt \
    | cut -f3 | awk '{print $1}' \
    | awk '{if ($1>10) {print 0} else print $1}' \
    | sort | uniq -c | 9_annotation_analysis/analize_annotation.py


##
## OLD
##
for GA_DIR in ${BASE_ANN_DIR}/annot_*; do
    9_annotation_analysis/check_gene_functions_kegg_full.sh $GA_DIR
done > ${BASE_ANN_DIR}/results_kegg_full_new.txt

cat ${BASE_ANN_DIR}/results_kegg_full_new.txt \
    | cut -f2 | awk '{print $1}' \
    | awk '{if ($1>10) {print 0} else print $1}' \
    | sort | uniq -c | 9_annotation_analysis/analize_annotation.py

